<?php

/**
 *   OPENSHOP 管理中心taobao 用户管理API
 * 
 *   @link        http://baison.com.cn
 *   @copyright   Baison, Inc.
 *   @package     OpenShop
 *   @version     $Id: api_tb_user.php,v 1.0 2009/10/10 08:36:58 created$
 *   @author      FillBag <fillbag@hotmail.com>
 */

define('IN_OS', true);

require(dirname(__FILE__) . '/includes/init.php');
require(ROOT_PATH . '/includes/modules/taobao.api/cls_api.php');
$exc = new exchange($os->table('taobao_goods'), $db, 'goods_id', 'goods_sn');
  global $_CFG;
   
//		API系统参数
	$topParamArr = array(
		'api_key' =>   $_CFG['taobao_app_key'] ,
		'method' => 'taobao.trades.sold.get', //taobao.item.get
		'format' => 'xml',
		'v' => '1.0',
		'timestamp' => date('Y-m-d H:i:s'), 
		'session' =>  $_CFG['taobao_sessionkey']   
	);   
	
if ($_REQUEST['act'] == 'list'){	
	//检查权限
	admin_priv(); 
		//API用户参数
		$userParamArr = array(
				'fields' => 'seller_nick,buyer_nick,title,type,created,sid,tid,seller_rate,buyer_rate,status,payment,discount_fee, adjust_fee,post_fee,pay_time,end_time,consign_time,modified,buyer_obtain_point_fee,point_fee, real_point_fee,received_payment,pic_path,iid,num,price,cod_fee,shipping_type',
				'page_size' => 20,
		     	'page_no' => ((isset($_GET['page']) && $_GET['page'] > 0) ? $_GET['page'] : 1)
	     	);   
		$result = lib_getArray_params_page( $topParamArr + $userParamArr , 'trade'); 
		$smarty->assign('user_items', $result );  
	    assign_query_info(); 
	    $smarty->display('api_tb_user_manage.tpl');	
	    
}elseif($_REQUEST['act'] == 'get_item'){
	//API用户参数
		$userParamArr = array(
					'fields' => 'seller_nick,buyer_nick,title,type,created,sid,tid,seller_rate,buyer_rate,status,payment,discount_fee, adjust_fee,post_fee,pay_time,end_time,consign_time,modified,buyer_obtain_point_fee,point_fee, real_point_fee,received_payment,pic_path,iid,num,price,cod_fee,shipping_type',
					'page_size' => 20,
			     	'page_no' => ((isset($_GET['page']) && $_GET['page'] > 0) ? $_GET['page'] : 1),
			     	'buyer_nick'   => $_GET('nick') 
				);  
	  $result = lib_getArray_params_page( $topParamArr + $userParamArr , 'trade');  
	  print_r($result);
}
?>